module decode_calculation(decode_in,decode_out,correct);
input [9:0] decode_in;
output [7:0] decode_out;
output correct;
wire [9:0] decode_in;
wire [7:0] decode_out;
wire correct;
reg correct4;
reg correct6;
wire [3:0] decode4b_in;
wire [5:0] decode6b_in;
reg [2:0] decode3b_out;
reg [4:0] decode5b_out;
assign {decode6b_in,decode4b_in} = decode_in;
assign decode_out = {decode3b_out,decode5b_out};
assign correct = correct4&correct6;

always@(decode4b_in)begin
	case(decode4b_in)
		4'b1011	: begin decode3b_out <= 3'b000; correct4 <= 1; end
		4'b0100	: begin decode3b_out <= 3'b000; correct4 <= 1; end
		4'b1001	: begin decode3b_out <= 3'b001; correct4 <= 1; end
		4'b0101	: begin decode3b_out <= 3'b010; correct4 <= 1; end
		4'b1100	: begin decode3b_out <= 3'b011; correct4 <= 1; end
		4'b1101	: begin decode3b_out <= 3'b100; correct4 <= 1; end
		4'b0010	: begin decode3b_out <= 3'b100; correct4 <= 1; end
		4'b1010	: begin decode3b_out <= 3'b101; correct4 <= 1; end
		4'b0110	: begin decode3b_out <= 3'b110; correct4 <= 1; end
		4'b0111	: begin decode3b_out <= 3'b111; correct4 <= 1; end
		4'b1000	: begin decode3b_out <= 3'b111; correct4 <= 1; end
		4'b1110	: begin decode3b_out <= 3'b111; correct4 <= 1; end
		4'b0001	: begin decode3b_out <= 3'b111; correct4 <= 1; end
		default		: begin decode3b_out <= 3'b000; correct4 <= 0; end
	endcase
end

always@(decode6b_in)begin
	case(decode6b_in)
		6'b100111  :	begin decode5b_out <=	5'h00	;  correct6 <= 1; end
		6'b011000  :	begin decode5b_out <=	5'h00	;  correct6 <= 1; end
		6'b011101  :	begin decode5b_out <=	5'h01	;  correct6 <= 1; end
		6'b100010  :	begin decode5b_out <=	5'h01	;  correct6 <= 1; end
		6'b101101  :	begin decode5b_out <=	5'h02	;  correct6 <= 1; end
		6'b010010  :	begin decode5b_out <=	5'h02	;  correct6 <= 1; end
		6'b110001  :	begin decode5b_out <=	5'h03	;  correct6 <= 1; end
		6'b110101  :	begin decode5b_out <=	5'h04	;  correct6 <= 1; end
		6'b001010  :	begin decode5b_out <=	5'h04	;  correct6 <= 1; end
		6'b101001  :	begin decode5b_out <=	5'h05	;  correct6 <= 1; end
		6'b011001  :	begin decode5b_out <=	5'h06	;  correct6 <= 1; end
		6'b111000  :	begin decode5b_out <=	5'h07	;  correct6 <= 1; end
		6'b111001  :	begin decode5b_out <=	5'h08	;  correct6 <= 1; end
		6'b000110  :	begin decode5b_out <=	5'h08	;  correct6 <= 1; end
		6'b100101  :	begin decode5b_out <=	5'h09	;  correct6 <= 1; end
		6'b010101  :	begin decode5b_out <=	5'h0a	;  correct6 <= 1; end
		6'b110100  :	begin decode5b_out <=	5'h0b	;  correct6 <= 1; end
		6'b001101  :	begin decode5b_out <=	5'h0c	;  correct6 <= 1; end
		6'b101100  :	begin decode5b_out <=	5'h0d	;  correct6 <= 1; end
		6'b011100  :	begin decode5b_out <=	5'h0e	;  correct6 <= 1; end
		6'b010111  :	begin decode5b_out <=	5'h0f 	;  correct6 <= 1; end
		6'b101000  :	begin decode5b_out <=	5'h0f 	;  correct6 <= 1; end
		6'b011011  :	begin decode5b_out <=	5'h10	;  correct6 <= 1; end
		6'b100100  :	begin decode5b_out <=	5'h10	;  correct6 <= 1; end
		6'b100011  :	begin decode5b_out <=	5'h11	;  correct6 <= 1; end
		6'b010011  :	begin decode5b_out <=	5'h12	;  correct6 <= 1; end
		6'b110010  :	begin decode5b_out <=	5'h13	;  correct6 <= 1; end
		6'b001011  :	begin decode5b_out <=	5'h14	;  correct6 <= 1; end
		6'b101010  :	begin decode5b_out <=	5'h15	;  correct6 <= 1; end
		6'b011010  :	begin decode5b_out <=	5'h16	;  correct6 <= 1; end
		6'b111010  :	begin decode5b_out <=	5'h17	;  correct6 <= 1; end
		6'b000101  :	begin decode5b_out <=	5'h17	;  correct6 <= 1; end
		6'b110011  :	begin decode5b_out <=	5'h18	;  correct6 <= 1; end
		6'b001100  :	begin decode5b_out <=	5'h18	;  correct6 <= 1; end
		6'b100110  :	begin decode5b_out <=	5'h19	;  correct6 <= 1; end
		6'b010110  :	begin decode5b_out <=	5'h1a	;  correct6 <= 1; end
		6'b110110  :	begin decode5b_out <=	5'h1b	;  correct6 <= 1; end
		6'b001001  :	begin decode5b_out <=	5'h1b	;  correct6 <= 1; end
		6'b001110  :	begin decode5b_out <=	5'h1c	;  correct6 <= 1; end
		6'b101110  :	begin decode5b_out <=	5'h1d	;  correct6 <= 1; end
		6'b010001  :	begin decode5b_out <=	5'h1d	;  correct6 <= 1; end
		6'b011110  :	begin decode5b_out <=	5'h1e	;  correct6 <= 1; end
		6'b100001  :	begin decode5b_out <=	5'h1e	;  correct6 <= 1; end
		6'b101011  :	begin decode5b_out <=	5'h1f 	;  correct6 <= 1; end
		6'b010100  :	begin decode5b_out <=	5'h1f 	;  correct6 <= 1; end
		default:		begin decode5b_out <=	5'h00 	;  correct6 <= 0; end
	endcase
end

endmodule